#!/bin/sh
#     2001:db8:a::       2001:db8:b::      2001:db8:c::      2001:db8:d::
#H1-------------------R1-----------------R2------------------R3---------------H2

nslist="H1 R1 R2 R3 H2"
for ns in $nslist
do
	ip netns add $ns
done

#H1
ip link add name H1_R1 type veth peer name R1_H1
ip link set H1_R1 netns H1
ip netns exec H1 bash -c \
'
	ip addr add 2001:db8:a::0/64 dev H1_R1
	ip addr add fe80::0 dev H1_R1
	ip link set lo up
	ip link set H1_R1 up
	ip -6 route add default via fe80::1 dev H1_R1
'

#R1
ip link add name R1_R2 type veth peer name R2_R1
ip link set R1_H1 netns R1
ip link set R1_R2 netns R1
ip netns exec R1 bash -c \
'
	ip addr add 2001:db8:a::1/64 dev R1_H1
	ip addr add 2001:db8:b::1/64 dev R1_R2
	ip addr add A0::1 dev lo
	ip addr add fe80::1 dev R1_H1
	ip addr add fe80::1 dev R1_R2
	ip link set lo up
	ip link set R1_H1 up
	ip link set R1_R2 up
'
